import config from '../config/config';
import request from '../utils/request';

let service = {};

//免费拿详情
service.getdetail = (param, cb) => {
  param = param || {};

  let requestUrl = config.api.getdetail;
  request({
    url: requestUrl,
    data: param,
    showLoading: true,
    method: 'GET',
    success: res => {
      cb(res);
    },
    fail: res => {
      // cb(res);
    }
  });
}

//次数检测
service.firstCheck = (param, cb) => {
  param = param || {};

  let requestUrl = config.api.firstCheck;
  request({
    url: requestUrl,
    data: param,
    method: 'GET',
    success: res => {
      cb(res);
    },
    fail: res => {
      // cb(res);
    }
  });
}

//轮播正在免费拿
service.collage = (param, cb) => {
  param = param || {};

  let requestUrl = config.api.collage;
  request({
    url: requestUrl,
    data: param,
    method: 'GET',
    success: res => {
      cb(res);
    },
    fail: res => {
      // cb(res);
    }
  });
}

//免费拿正式创建订单
service.createorder = (param, cb) => {
  param = param || {};

  let requestUrl = config.api.createorder;
  request({
    url: requestUrl,
    data: param,
    method: 'POST',
    success: res => {
      cb(res);
    },
    fail: res => {
      // cb(res);
    }
  });
}

module.exports = service;